package com.sugar.psych.assessment.module.business.controller.app.userleavemessage.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

import static com.sugar.psych.assessment.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "App - 用户留言 Response VO")
@Data
public class AppUserLeaveMessageRespVO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2179")
    private Long id;

    @Schema(description = "匿名名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
    private String anonymityName;

    @Schema(description = "匿名头像", requiredMode = Schema.RequiredMode.REQUIRED)
    private String anonymityAvatar;

    @Schema(description = "留言内容", requiredMode = Schema.RequiredMode.REQUIRED)
    private String content;

    @Schema(description = "被赞总次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "16392")
    private Integer likedCount;

    @Schema(description = "是否点过赞（false否 true是）", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Boolean liked;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime createTime;
}